Feature/allow custom user defined checks #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for custom checks
Hi! I came across the project and I really like how simple and straightforward it is. I needed a tool to watch a few processes and that made me think of a potential addition that would help me achieve what I need.
In my case, I needed to have a check that didn't fall into the supported categories, so I thought I would add a type for user-defined checks where a user can run any python method that returns a boolean. This can cover a wide range of checks without having a very tailored solution to different use cases.
Further details
The new check type accepts a module and a method name, as well as a dictionary of variables. The script calls the defined method with those variables and displays "operational" if the check passed, and "down" if it didn't. I added an example in the readme file to make it easy to configure.
One sample use case of this would be performing a simple processing on the response of an API. The user can define a function where they check for an expected value, and return True / False accordingly.
Looking forward to seeing your review!